和<?php

require_once("inc.member.php");



$this_title="$vars[member_title] &raquo; ".replace_tag(__("<%title%> History"), array("<%title%>"=>__($vars['cwallet_title'])));

$page_title=replace_tag(__("<%title%> History"), array("<%title%>"=>__($vars['cwallet_title'])));

$content_title=replace_tag(__("<%title%> History"), array("<%title%>"=>__($vars['cwallet_title'])));



$item_per_page=$vars["user_item_per_page"];



require_once("inc.wallet_select.php");



//#####LIST EWALLET HISTORY#####

$count_sql="select count(*) from $db->member_cwallet_record where uid='$uid'";

$record_sql="select * from $db->member_cwallet_record where uid='$uid' order by cdate desc limit <%limit_start%>, <%limit%>";



$cur_page=$_GET["nav"];

$total_record=@mysql_result(mysql_query($count_sql), 0);

$total_page=ceil($total_record/$item_per_page);

$page=($cur_page? ($cur_page>$total_page? $total_page : ($cur_page<1? 1 : $cur_page)) : 1);

$limit_start=($page-1)*$item_per_page;

$nav_link=format_page($page, $total_page, 15);

$this_page_total=@mysql_num_rows($r=mysql_query(str_replace("<%limit_start%>", $limit_start, str_replace("<%limit%>", $item_per_page, $record_sql))));

$k=0;

for($i=0;$i<$this_page_total;$i++){

 $p=mysql_fetch_assoc($r);

 $his_row.='
	<tr class="'.($k==0?'even':'odd').'">
        <td class="center">'.date($vars['date_format'], strtotime($p["cdate"])).'</td>
		<td>'.number_format(in_array($p['type'],array('c','credit'))? $p['amount'] : 0, 2).'</td>
		<td>'.number_format(!in_array($p['type'],array('c','credit'))? $p['amount'] : 0, 2).'</td>
        <td class="center">'.nl2br($p["bal"]).'</td>
	</tr>
 ';

 $k=1-$k;

}



//listing text

$listing_text=replace_tag(__("<%x%> <%title%> <%record%>."), array("<%x%>"=>"$total_record", "<%title%>"=>__($vars['cwallet_title']), "<%record%>"=>$total_record>1? __("records") : __("record")));



//listing

$his_list=
'
<div class="panel panel-sky">
                        <div class="panel-heading">
                            <h4>'.$content_title.'</h4>
                            <div class="options">   
                                <a href="javascript:;"><i class="fa fa-cog"></i></a>
                                <a href="javascript:;"><i class="fa fa-wrench"></i></a>
                                <a href="javascript:;" class="panel-collapse"><i class="fa fa-chevron-down"></i></a>
                            </div>
                        </div>
                        <div class="panel-body collapse in">
                            <table cellpadding="0" cellspacing="0" border="0" class="table table-striped table-bordered datatables" id="example">
                                <thead>
                                    <tr>
                                        <th>'.__("Date").'</th>
                                        <th>'.__("Description").'</th>
                                        <th>'.__("Credit").'</th>
                                        <th>'.__("Debit").'</th>
                                        <th>'.__("Balance").'</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    '.$his_row.'
                                </tbody>
                            </table>
                        </div>
                    </div>
';


$content=$his_list;

print format_member_page($content, $this_title, $content_title, $css . $inc_jvscript);

?>